<?php
require_once("includes/include.php");
require_once('Downloadnew/Download.php');
require_once('helper/helper.php');
@session_start();
class blogManage extends blogdao{
	public $Downlod;
	public $helper;
	public function __construct(){
		$this->Downlod = new Download();
		$this->helper = new Helper();
	}
	public function readBlogDraft(){
		$userId = $_SESSION["userId"];
		$dao =new blogdao();
		$blogDraft = $dao->goReadBlogDraft($userId);
		return $blogDraft;
	}
	public function readTargetDraft($draftid){
		$dao =new blogdao();
		$blogDraft = $dao->goReadTargetDraft($draftid);
		return $blogDraft;
	}
		
}

$post = $_POST;
//读取所有草稿
if(!empty($post)&&$post['postType']==3) {
	$manage = new blogManage();
	$blogDrafts = $manage->readBlogDraft();
	if (!empty($blogDrafts)){
		echo "<div class='blogdraftclose'><span onclick='closeBlogDraft(this)'><img src='style/window_close.png' alt='close' title='关闭' /></span></div>";
		foreach ($blogDrafts as $blogDraft){
			echo "<div class='blogdraftitermsload' id='blogdraftitermsload".$blogDraft['id']."'><div class='blogdrafttitle'><input type='radio' name='blogdraftradio' class='blogdraftradio' value=".$blogDraft['id']." />".$blogDraft['title']."</div><div class='blogdrafttime'>".$blogDraft['postTime']."&nbsp;&nbsp;&nbsp;&nbsp;<a onclick=\"deleteblogdraft('".$blogDraft['id']."')\">删除</a></div></div>";
		}
		echo "<div class='blogiterm' style='border:0px;'><div class='blogdrafttitle' style='margin-top:20px;margin-bottom:20px;'><button onclick=\"loadBlogDraft()\">加载当前草稿</button></div></div>";
	}else{
		echo "<div class='blogdraftclose'><span onclick='closeBlogDraft(this)'>关闭</span></div>";
		echo "<div style ='clear:both;margin-bottom:10px;'>没有草稿</div>";
	}
}else if(!empty($post)&&$post['postType']==3){
	
}
?>